import { fromJS } from 'immutable';
import * as constants from './constants';

const defaultState = fromJS({
	myCourse: [],
	courseList: [],
	mySubject: [],
	subCourse: []
});

export default (state = defaultState, action) => {
	switch(action.type) {
		case constants.CHANGE_MYCOURSE:
			return state.set('myCourse', action.value);
		case constants.CHANGE_COURSELIST:
			return state.set('courseList', action.value);
		case constants.CHANGE_MYSUBJECT:
			return state.set('mySubject', action.value);
		case constants.CHANGE_SUBJECTCOURSE:
			return state.set('subCourse', action.value)
		default:
			return state;
	}
}